/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-01-26
 * Time: 22:03
 */
public class Test {
    public static void main(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        for (int i = 0; i < 5; i++) {
            myArrayList.add(i,i+1);
        }
        myArrayList.display();
        System.out.println("==============");
        //给下标为2的位置元素更新为99
        myArrayList.setPos(2,99);
        myArrayList.display();
        System.out.println("==============");
        // 获取下标为4的元素
        System.out.println(myArrayList.getPos(4));
        //判断顺序表中是否有元素7，有返回true，没有就返回false
        System.out.println(myArrayList.contains(7));
        //判断顺序表中是否有元素5，有返回其所在位置的下标，没有就返回-1
        System.out.println(myArrayList.search(5));
        myArrayList.display();
        System.out.println("==============");
        //删除顺序表中的元素1
        myArrayList.remove(1);
        myArrayList.display();
        System.out.println("==============");
        myArrayList.clear();
        myArrayList.display();
    }
}
